Various warning fixes and one code gen problem to successfully build with clang.
authorrobertl <robertl>
Fri, 27 Aug 2010 16:04:07 +0000 (16:04 +0000)
committerrobertl <robertl>
Fri, 27 Aug 2010 16:04:07 +0000 (16:04 +0000)
csv_util.c
geoniche.c
itracku.c
mac/libusb/darwin.c
mmo.c
nmea.c
tef_xml.c
xcsv_tokens.gperf

index 4b9cfb97e0e9daadb49affe8b6e590230cc31c74..626066b67f965a1f812dfcbf92a9e0952834e7df 100644 (file)
@@ -136,6 +136,10 @@ typedef enum {
        XT_YYYYMMDD_TIME
 } xcsv_token;
 
+// Static definition of in_word_set to meet C99 rules as used by Clang.
+static struct xt_mapping *
+in_word_set (register const char *str, register unsigned int len);
+
 #include "xcsv_tokens.gperf"
 
 /****************************************************************************/
@@ -704,7 +708,7 @@ xcsv_file_init(void)
      */
     xcsv_file.type = ff_type_file;
 
-    xcsv_file.mkshort_handle = (struct short_handle_*) mkshort_new_handle();
+    xcsv_file.mkshort_handle = (struct short_handle *) mkshort_new_handle();
     xcsv_file.gps_datum = GPS_DATUM_WGS84;
 }
 
index a0992148bc573779d89afc4e23157bbecf84b351..65f84a9ea4c11c82ba889b95c2f75737e6504e7d 100644 (file)
@@ -604,6 +604,7 @@ wpt2icon(const waypoint *wpt)
        case gt_benchmark: return 0;
        case gt_ape: return 0;
        case gt_mega: return 0;
+       case gt_wherigo: return 0;
     }
 
     return 0;
index d23d91696b22f8eb79b5c54cffe8ff2c0d919e8a..ee23585db53299524bbd266aea6cc5d36623b86d 100644 (file)
--- a/itracku.c
+++ b/itracku.c
@@ -191,33 +191,36 @@ itracku_device_update_data_read(void* buf, int len)
 
        49 degrees 34.7687 minutes
 */
+// The argument is marked 'volatile' because of an issue in Apple's v1.5 clang.
+// Without this, the sign of 'x' mysteriously changes while in the function.
+// adding a printf inside branches not taken changes the behaviour.   Very
+// mysterious, but not worth tracking down at this time.   When xcode 4 comes
+// along (or anyone really cares about mega performance of this fairly obscure
+// target, we should revisit this.
 double
-deg_min_to_deg(gbuint32 x)
+deg_min_to_deg(volatile gbuint32 x)
 {
     double sign;
-       gbuint32 sep;
-       gbuint32 d;
-       gbuint32 m10000;
-
+    gbuint32 sep;
+    gbuint32 d;
+    gbuint32 m10000;
     // determine the sign
-       if (x > 0x80000000) {
+    if (x > 0x80000000) {
         sign = -1.0;
         x -= 0x80000000;
-    }
-    else {
+    } else {
         sign = 1.0;
     }
 
     sep = 1000000;
     
-       // extract degrees
-       d = x / sep;
-
-       // extract (minutes * 10000)
+    // extract degrees
+    d = (unsigned int) x / (unsigned int) sep;
+    // extract (minutes * 10000)
     m10000 = x - d * sep;
 
     // convert minutes and degrees to a double
-       return sign * ((double)d + ((double)m10000) / 600000.0);
+    return sign * ((double)d + ((double)m10000) / 600000.0);
 }
 
 /*
@@ -493,6 +496,7 @@ static int
 import_data_record(itracku_data_record* d)
 {
        int result = 0;
+
        if (!itracku_is_valid_data_record(d)) {
                result = 0;
        }
index 08b39a4e528bbad971296b16fdd275194be65409..d550fa6b13a05d43f9d473a0ca673a586b0da605 100644 (file)
@@ -248,7 +248,8 @@ static usb_device_t **usb_get_next_device (io_iterator_t deviceIterator, UInt32
   io_cf_plugin_ref_t *plugInInterface = NULL;
   usb_device_t **device;
   io_service_t usbDevice;
-  long result, score;
+  long result;
+  SInt32 score;
 
   if (!IOIteratorIsValid (deviceIterator) || !(usbDevice = IOIteratorNext(deviceIterator)))
     return NULL;
@@ -448,7 +449,7 @@ static int claim_interface (usb_dev_handle *dev, int interface)
   IOUSBFindInterfaceRequest request;
 
   struct darwin_dev_handle *device;
-  long score;
+  SInt32 score;
   int current_interface;
 
   device = dev->impl_info;
@@ -1114,7 +1115,7 @@ int usb_os_find_devices(struct usb_bus *bus, struct usb_device **devices)
     result = (*(device))->GetDeviceAddress(device, (USBDeviceAddress *)&address);
 
     if (usb_debug >= 2)
-      fprintf(stderr, "usb_os_find_devices: Found USB device at location 0x%08lx\n", location);
+      fprintf(stderr, "usb_os_find_devices: Found USB device at location 0x%08x\n", location);
 
     /* first byte of location appears to be associated with the device's bus */
     if (location >> 24 == bus_loc >> 24) {
@@ -1141,7 +1142,7 @@ int usb_os_find_devices(struct usb_bus *bus, struct usb_device **devices)
       LIST_ADD(fdev, dev);
 
       if (usb_debug >= 2)
-       fprintf(stderr, "usb_os_find_devices: Found %s on %s at location 0x%08lx\n",
+       fprintf(stderr, "usb_os_find_devices: Found %s on %s at location 0x%08x\n",
                dev->filename, bus->dirname, location);
     }
 
diff --git a/mmo.c b/mmo.c
index 6562d7b81942ddc9e39ea68cb4fd954531d66798..c8d1b433097fd9f77554516264458fe7b7dd7d97 100644 (file)
--- a/mmo.c
+++ b/mmo.c
@@ -149,7 +149,7 @@ dbgprintf(const char *sobj, const char *fmt, ...)
 
 # define DBG(args) dbgprintf args
 #else
-# define DBG(args) ;
+# define DBG(args) do {} while (0) ;
 #endif
 
 static char *
diff --git a/nmea.c b/nmea.c
index 2f0276f74f46b32113ddc91f3d7e000b19a5da4e..df3da62bdb97e86c37aea8b31ca54e9771547e7d 100644 (file)
--- a/nmea.c
+++ b/nmea.c
@@ -331,7 +331,7 @@ nmea_wr_init(const char *portname)
                }
        }
 
-       mkshort_handle = (struct short_handle_*) mkshort_new_handle();
+       mkshort_handle = (struct short_handle*) mkshort_new_handle();
        setshort_length(mkshort_handle, atoi(snlenopt));
 
        if (opt_gisteq) {
index 70d9d0dfdaa389d2903971981a2bde01d4cac87b..8d2d82d2021c4345b17b1b26a4401b86516e6a5f 100644 (file)
--- a/tef_xml.c
+++ b/tef_xml.c
@@ -249,7 +249,7 @@ tef_item_start(const char *args, const char **attrv)
                else if (0 == case_ignore_strcmp(avp[0], "Altitude"))
                        wpt_tmp->altitude = atof(avp[1]);
                else if (0 == case_ignore_strcmp(avp[0], "TimeStamp"))
-                       /* nothing for the moment */;
+                       { /* nothing for the moment */ }
 
                avp+=2;
        }
index a525f4a0cb225c8f85e2db79924f3071df72f597..9fc27f1ce3e43aefc13dc661b6c8b97cfd7b5aed 100644 (file)
@@ -1,4 +1,4 @@
-/* ANSI-C code produced by gperf version 3.0.1 */
+/* ANSI-C code produced by gperf version 3.0.3 */
 /* Command-line: gperf -L ANSI-C -D -t xcsv_tokens.in  */
 /* Computed positions: -k'2,4-5,12,$' */
 
@@ -107,6 +107,9 @@ hash (register const char *str, register unsigned int len)
 
 #ifdef __GNUC__
 __inline
+#ifdef __GNUC_STDC_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
 #endif
 struct xt_mapping *
 in_word_set (register const char *str, register unsigned int len)